﻿using System.Web.Mvc;
using System.Web.Routing;
using Nop.Web.Framework.Mvc.Routes;
using Spotshub.Plugin.Payments.GlobalPayments.ViewEngines;

namespace Spotshub.Plugin.Payments.GlobalPayments
{
    public partial class RouteProvider : IRouteProvider
    {
        public void RegisterRoutes(RouteCollection routes)
        {
            System.Web.Mvc.ViewEngines.Engines.Add(new SpotsHUBGlobalPaymentsViewEngine());
            routes.MapRoute("Plugin.Payments.GlobalPayments.Configure",
                 "Plugins/PaymentGlobalPayments/Configure",
                 new { controller = "PaymentGlobalPayments", action = "Configure" },
                 new[] { "Spotshub.Plugin.Payments.GlobalPayments.Controllers" }
            );

            routes.MapRoute("Plugin.Payments.GlobalPayments.SaveGeneralSettings",
                 "Plugins/PaymentGlobalPayments/SaveGeneralSettings",
                 new { controller = "PaymentGlobalPayments", action = "SaveGeneralSettings" },
                 new[] { "Spotshub.Plugin.Payments.GlobalPayments.Controllers" }
            );

            routes.MapRoute("Plugin.Payments.GlobalPayments.ProfileConfigure",
                 "Plugins/PaymentGlobalPayments/ProfileConfigure",
                 new { controller = "PaymentGlobalPayments", action = "ProfileConfigure" },
                 new[] { "Spotshub.Plugin.Payments.GlobalPayments.Controllers" }
            );

            routes.MapRoute("Plugin.Payments.GlobalPayments.ProfileList",
                 "Plugins/PaymentGlobalPayments/ProfileList",
                 new { controller = "PaymentGlobalPayments", action = "ProfileList" },
                 new[] { "Spotshub.Plugin.Payments.GlobalPayments.Controllers" }
            );

            routes.MapRoute("Plugin.Payments.GlobalPayments.ProfileAdd",
                 "Plugins/PaymentGlobalPayments/ProfileAdd",
                 new { controller = "PaymentGlobalPayments", action = "ProfileAdd" },
                 new[] { "Spotshub.Plugin.Payments.GlobalPayments.Controllers" }
            );

            routes.MapRoute("Plugin.Payments.GlobalPayments.ProfileEdit",
                 "Plugins/PaymentGlobalPayments/ProfileEdit",
                 new { controller = "PaymentGlobalPayments", action = "ProfileEdit" },
                 new[] { "Spotshub.Plugin.Payments.GlobalPayments.Controllers" }
            );

            routes.MapRoute("Plugin.Payments.GlobalPayments.ProfileDelete",
                 "Plugins/PaymentGlobalPayments/ProfileDelete",
                 new { controller = "PaymentGlobalPayments", action = "ProfileDelete" },
                 new[] { "Spotshub.Plugin.Payments.GlobalPayments.Controllers" }
            );

            routes.MapRoute("Plugin.Payments.GlobalPayments.PaymentInfo",
                 "Plugins/PaymentGlobalPayments/PaymentInfo",
                 new { controller = "PaymentGlobalPayments", action = "PaymentInfo" },
                 new[] { "Spotshub.Plugin.Payments.GlobalPayments.Controllers" }
            );

            routes.MapRoute("Plugin.Payments.GlobalPayments.ServerNotificationHandler",
                 "Plugins/PaymentGlobalPayments/NotificationHandler",
                 new { controller = "PaymentGlobalPayments", action = "ServerNotificationHandler" },
                 new[] { "Spotshub.Plugin.Payments.GlobalPayments.Controllers" }
            );

            routes.MapRoute("Plugin.Payments.GlobalPayments.SaveCreditCard",
                 "Plugins/PaymentGlobalPayments/SaveCreditCard",
                 new { controller = "PaymentGlobalPayments", action = "SaveCreditCard" },
                 new[] { "Spotshub.Plugin.Payments.GlobalPayments.Controllers" }
            );

            routes.MapRoute("Plugin.Payments.GlobalPayments.RemoveCreditCard",
                 "Plugin.Payments.GlobalPayments.RemoveCreditCard",
                 new { controller = "PaymentGlobalPayments", action = "RemoveCreditCard" },
                 new[] { "Spotshub.Plugin.Payments.GlobalPayments.Controllers" }
            );
            
            routes.MapRoute("Plugin.Payments.GlobalPayments.GetSecureFormUrl",
                "Plugins/PaymentGlobalPayments/GetSecureFormUrl",
                new { controller = "PaymentGlobalPayments", action = "GetSecureFormUrl" },
                new[] { "Spotshub.Plugin.Payments.GlobalPayments.Controllers" }
            );
            routes.MapRoute("Plugin.Payments.GlobalPayments.HandleTransaction",
               "Plugins/PaymentGlobalPayments/HandleTransaction",
               new { controller = "PaymentGlobalPayments", action = "HandleTransaction" },
               new[] { "Spotshub.Plugin.Payments.GlobalPayments.Controllers" }
           );
        }

        public int Priority
        {
            get
            {
                return 0;
            }
        }
    }
}
